﻿<%@ Page Language="C#" AutoEventWireup="True" CodeFile="Default.aspx.cs" Inherits="LDAP.Web.Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>登录</title>
    <link href="themes/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <style type="text/css">
        body {
          padding-top: 40px;
          padding-bottom: 40px;
          background-color: #eee;
          font-family:'Microsoft YaHei';
        }

        .container {
          width: 540px;
          padding: 15px;
          margin: 0 auto;
        }
        .form-signin .form-signin-heading,
        .form-signin .checkbox {
          margin-bottom: 30px;
        }
        .form-signin .checkbox {
          font-weight: normal;
        }
        .form-signin .form-control {
          position: relative;
          font-size: 16px;
          height: auto;
          padding: 10px;
          -webkit-box-sizing: border-box;
             -moz-box-sizing: border-box;
                  box-sizing: border-box;
        }
        .form-signin .form-control:focus {
          z-index: 2;
        }
        .form-signin input[type="text"] {
          margin-bottom: -1px;
          border-bottom-left-radius: 0;
          border-bottom-right-radius: 0;
        }
        .form-signin input[type="password"] {
          margin-bottom: 10px;
          border-top-left-radius: 0;
          border-top-right-radius: 0;
        }
    </style>
</head>
<body>
    <% if(string.IsNullOrEmpty(UserInfo)){ %>
    <div class="container ">
        <form class="form-horizontal" role="form">
          <div class="form-group">
              <div class="col-sm-offset-1 col-sm-11" style="padding-left:0;">
                  <h2 class="form-signin-heading"><span class="navbar-brand" style="float:none; background:url(<%= StaticDomain %>/images/17173-logo-50x133.png) no-repeat; padding-left:133px; line-height:26px; ">用户登录</span></h2>        
              </div>
          </div>
          <div class="form-group">
            <label for="account" class="col-sm-2 control-label">工号</label>
            <div class="col-sm-10">
              <input type="text" class="form-control" id="account" placeholder="工号（CYXXXX）" required />
            </div>
          </div>
          <div class="form-group">
            <label for="password" class="col-sm-2 control-label">密码</label>
            <div class="col-sm-10">
              <input type="password" class="form-control" id="password" placeholder="密码（同VPN/WIFI密码）" required />
            </div>
          </div>
         <%-- <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
              <div class="checkbox">
                <label>
                  <input type="checkbox"> Remember me
                </label>
              </div>
            </div>
          </div>--%>
          <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
              <button type="submit" class="btn btn-default btn-primary" onclick="login(); return false;" >登录</button>
            </div>
          </div>
      </form>
    </div>
    <script src="<%= StaticDomain %>/scripts/jquery.js"></script>

    <script type="text/javascript">
        function login() {
            $.post("/handler/public.ashx?action=login", { username: $("#account").val(), password: $("#password").val() }, function (data) {
                if (data && data.code == 1) {
                    //window.location.href = "aixiaoxin.aspx";
                    window.location.href="/Attendance/Default.aspx";
                }
                else {
                    data = data || {error:"系统繁忙，请刷新页面再试"};
                    alert(data.error);
                }
            }, "json")
        }
    </script>
    <%}
       else {
           Response.Redirect("/Attendance/Default.aspx"); 
           //Response.Redirect("aixiaoxin.aspx"); 
       } %>
</body>
</html>
